Update size of root window after display reconfiguration
authorKristian Rietveld <kris@gtk.org>
Mon, 26 Oct 2009 07:53:20 +0000 (08:53 +0100)
committerKristian Rietveld <kris@gtk.org>
Mon, 26 Oct 2009 08:52:54 +0000 (09:52 +0100)
gdk/quartz/gdkprivate-quartz.h
gdk/quartz/gdkscreen-quartz.c
gdk/quartz/gdkwindow-quartz.c

index 258d1f8c70c099307d15a5adcdb08e7eea1b653e..dadec3f54952a42cc66b8a8031eaedb5d2397f95 100644 (file)
@@ -105,11 +105,12 @@ extern GdkDragContext *_gdk_quartz_drag_source_context;
 #define GDK_WINDOW_IS_QUARTZ(win)        (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)win)->impl))
 
 /* Initialization */
-void _gdk_windowing_window_init  (void);
-void _gdk_events_init            (void);
-void _gdk_visual_init            (void);
-void _gdk_input_init             (void);
-void _gdk_quartz_event_loop_init (void);
+void _gdk_windowing_update_root_window_size (GdkScreen *screen);
+void _gdk_windowing_window_init             (void);
+void _gdk_events_init                       (void);
+void _gdk_visual_init                       (void);
+void _gdk_input_init                        (void);
+void _gdk_quartz_event_loop_init            (void);
 
 /* GC */
 typedef enum {
index 54577eda7ed9af9ccc29af4d263925b10c64672e..5c3db27586f75803f5423cd09e2b24d13bae0704 100644 (file)
@@ -177,6 +177,8 @@ process_display_reconfiguration (GdkScreenQuartz *screen)
 
   gdk_screen_quartz_calculate_layout (GDK_SCREEN_QUARTZ (screen));
 
+  _gdk_windowing_update_root_window_size (GDK_SCREEN (screen));
+
   if (screen->emit_monitors_changed)
     {
       g_signal_emit_by_name (screen, "monitors-changed");
index f60cc79779413fc64c1f768e31a45375d4ceeb04..cda36154ce725c375b0e1796efb3f673cf9e3842 100644 (file)
@@ -1090,6 +1090,26 @@ _gdk_window_impl_new (GdkWindow     *window,
     gdk_window_set_type_hint (window, attributes->type_hint);
 }
 
+void
+_gdk_windowing_update_root_window_size (GdkScreen *screen)
+{
+  GdkWindowObject *private = (GdkWindowObject *)_gdk_root;
+
+  /* The size of the root window is so that it can contain all
+   * monitors attached to this machine.  The monitors are laid out
+   * within this root window.  We calculate the size of the root window
+   * and the positions of the different monitors in gdkscreen-quartz.c.
+   *
+   * This data is updated when the monitor configuration is changed.
+   */
+  private->x = 0;
+  private->y = 0;
+  private->abs_x = 0;
+  private->abs_y = 0;
+  private->width = gdk_screen_get_width (screen);
+  private->height = gdk_screen_get_height (screen);
+}
+
 void
 _gdk_windowing_window_init (void)
 {
@@ -1107,18 +1127,7 @@ _gdk_windowing_window_init (void)
 
   impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
 
-  /* The size of the root window should be the same as the size of
-   * the screen it belongs to.
-   *
-   * FIXME: Of course this needs to be updated when you change the monitor
-   * configuration (add another one, remove one, etc).
-   */
-  private->x = 0;
-  private->y = 0;
-  private->abs_x = 0;
-  private->abs_y = 0;
-  private->width = gdk_screen_get_width (_gdk_screen);
-  private->height = gdk_screen_get_height (_gdk_screen);
+  _gdk_windowing_update_root_window_size (_gdk_screen);
 
   private->state = 0; /* We don't want GDK_WINDOW_STATE_WITHDRAWN here */
   private->window_type = GDK_WINDOW_ROOT;